// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 验证指定的字段内容是否存在 GET /api/user/check-is-redundant */
export async function getApiUserCheckIsRedundant(
  params: {
    // query
    fieldname?: string;
    fieldvalue?: string;
    ignoreid?: number;
  },
  options?: { [key: string]: any },
) {
  return request<any>('/api/user/check-is-redundant', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取全部人员 GET /api/user/all */
export async function getApiUserAll(options?: { [key: string]: any }) {
  return request<API.SimpleResultListUserDto>('/api/user/all', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 添加用户 POST /api/user */
export async function postApiUser(body: API.UserCreateDto, options?: { [key: string]: any }) {
  return request<any>('/api/user', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除一个或多个用户 DELETE /api/user */
export async function deleteApiUser(body: number[], options?: { [key: string]: any }) {
  return request<any>('/api/user', {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新用户 PUT /api/user/${param0} */
export async function putApiUserById(
  params: {
    // path
    id: number;
  },
  body: API.UserModifyDto,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/user/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获取通行证信息 GET /api/user/${param0}/passports */
export async function getApiUserByIdPassports(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListUserPassportDto>(`/api/user/${param0}/passports`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新通行证状态 PATCH /api/user/${param0}/passport-state */
export async function patchApiUserByIdPassportState(
  params: {
    // path
    id: number;
  },
  body: API.UserPassportStateChangeDto,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/user/${param0}/passport-state`, {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 修改密码 PATCH /api/user/${param0}/updata-password/${param1} */
export async function patchApiUserByIdUpdataPasswordByNewpassword(
  params: {
    // path
    id: number;
    newpassword: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, newpassword: param1, ...queryParams } = params;
  return request<any>(`/api/user/${param0}/updata-password/${param1}`, {
    method: 'PATCH',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 获取权限 GET /api/user/${param0}/permissions */
export async function getApiUserByIdPermissions(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListString>(`/api/user/${param0}/permissions`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新权限 PUT /api/user/${param0}/permissions */
export async function putApiUserByIdPermissions(
  params: {
    // path
    id: number;
  },
  body: string[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/user/${param0}/permissions`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 分页查询 POST /api/user/${param0}/${param1}/paged-list */
export async function postApiUserByIndexByLimitPagedList(
  params: {
    // query
    /** 开始时间 */
    StartTime?: string;
    /** 结束时间 */
    EndTime?: string;
    /** 关键字查询 */
    Keyword?: string;
    /** 机构id列表 */
    OrgIds?: string[];
    // path
    /** 当前页码 */
    index: number;
    /** 每页数量 */
    limit: number;
  },
  body: API.UserSort,
  options?: { [key: string]: any },
) {
  const { index: param0, limit: param1, ...queryParams } = params;
  return request<API.SimpleResultPagingListUserDto>(`/api/user/${param0}/${param1}/paged-list`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: {
      ...queryParams,
    },
    data: body,
    ...(options || {}),
  });
}

/** 查询明细数据 GET /api/user/detail/${param0} */
export async function getApiUserDetailById(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultUserDetailDto>(`/api/user/detail/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}
